<div class="layui-form" lay-filter="layuiadmin-form-post" style="padding: 20px 0 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label" style="width: 100px">岗位名称</label>
        <div class="layui-input-inline" style="width: 290px">
            <script type="text/html" template="">
                <input list="options" name="GWMC" lay-verify="required" class="layui-input"
                       placeholder="请输入岗位名称"
                       value="{{d.params.GWMC||''}}"
                       autocomplete="off">
                <datalist id="options">

                </datalist>
            </script>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width: 100px">税务机关名称</label>
        <div class="layui-input-inline" style="width: 290px">
            <script type="text/html" template>

                <select name="SWJGDM" lay-verify="required" lay-search>
                    <option value=""></option>
                    {{# if(d.params.SWJGDM){ }}
                    {{# layui.each(layui.data('layuiAdmin').swjg_info,function(index,item){ console.log("编辑税务机关信息==" +
                    JSON.stringify(d.params) + "===" + JSON.stringify(item)) }}
                    <option value={{item.swjgdm}} {{ (d.params.SWJGMC=== item.swjgmc ?
                    'selected' : '') }}>{{item.swjgmc}}</option>
                    {{# }); }}
                    {{#}else{ }}
                    {{# layui.each(layui.data('layuiAdmin').swjg_info,function(index,item){ console.log("添加税务机关信息==" +
                    JSON.stringify(item)) }}
                    <option value={{item.swjgdm}}>{{item.swjgmc}}</option>
                    {{# }); }}
                    {{# } }}
                </select>

            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width: 100px"></label>
        <div class="layui-input-inline">
            <input type="button" lay-submit lay-filter="LAY-post-front-submit" value="确认" class="layui-btn mybtn">
        </div>
    </div>
</div>
<script>
    // 获取所有税务机关的信息
    function getSwjg() {
        $.ajax({
            url: layui.setter.hostAddr + '/portal/swjg/swjglist',
            beforeSend: function (XMLHttpRequest) {
                XMLHttpRequest.setRequestHeader("Authorization", layui.data('layuiAdmin', 'Authorization'));
            },
            dataType: 'json',
            type: "GET",
            async: false,
            success: function (result) {
                var option_str = ''
                for (var i in result.data) {
                    option_str = option_str + `<option value=${result.data[i].swjgdm} >${result.data[i].swjgmc}</option>`
                }
                $("#swjg").empty()
                $("#swjg").append(option_str)
            },
        });
        console.log(111)
    }


    layui.use(['form'], function () {
        var form = layui.form
        form.verify({
            isExist: function (value) {
                var params = $('.layui-input-inline input[name="name"]').val();
                debugger
                var data;
                // $.ajax({
                //     url: 'http://172.20.10.12:8000/post/',
                //     beforeSend: function (XMLHttpRequest) {
                //         XMLHttpRequest.setRequestHeader("Authorization", layui.data('layuiAdmin', 'Authorization'));
                //     },
                //     contentType: "application/json",
                //     dataType: 'json',
                //     type: "post",
                //     async: false,
                //     data: JSON.stringify({"name": params}),
                //     success: function (result) {
                //         data = result
                //     },
                // });
                if (false) {
                    return '用户id已存在';
                }

            }
        })
    })
</script>



